Authentication Message
Before You Start
You need to meet all the prerequisites listed in the Before You Start section of the documentation.
To send an Authentication message, Please use below payload format.
Step 1: Make POST Request
Payload
{
"recipient_type": "individual",
"to": "<user number>",
"type": "template",
"template": {
"name": "<template name>",
"language": {
"code": "en"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "123456"
}
]
},
{
"type": "button",
"sub_type": "url",
"index": "0",
"parameters": [
{
"type": "text",
"text": "123456"
}
]
}
]
},
"metadata": {
"messageId": "msg123",
"transactionId": "aewqtyu"
}
}
Process authentication template message on priority
If you want to process authentication message on priority then add auth_message inside metadata and set it to true.
Payload
{
"recipient_type": "individual",
"to": "<user number>",
"type": "template",
"template": {
"name": "<template name>",
"language": {
"policy": "deterministic",
"code": "<language>"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "<one-time-password>"
}
]
},
{
"type": "button",
"index": "0",
"sub_type": "url",
"parameters": [
{
"type": "text",
"text": "<one-time-password>"
}
]
}
]
},
"metadata": {
"messageId": "<messageId>",
"auth_message": true
}
}
Step 2: Check Your Response
The response example shows a sample response from the API request: Possible elements in responses includes,
- Success Response
Payload
{
"success": true,
"responseId": "1606887827245734233232332"
}
- An unsuccessful response contains an error message. See Error and Status Codes for more information.
For more details, please refer https://developers.facebook.com/docs/whatsapp/business-management-api/authentication-templates/.